package tg.app.opticket;

import java.rmi.RemoteException;
import java.util.Vector;

import psdi.mbo.Mbo;
import psdi.mbo.MboRemote;
import psdi.mbo.MboSet;
import psdi.server.MXServer;
import psdi.util.MXException;

/***
 * 
 * @author pzx
 *
 */
public class OpticketStatus extends Mbo implements MboRemote {

	public OpticketStatus(MboSet ms) throws RemoteException {
		super(ms);
	}

	public void init() throws MXException {
		setFlag(7L, true);
		super.init();
	}


	public void add() throws MXException, RemoteException {
		MboRemote mboremote = getOwner();
		if ((mboremote != null) && ("OPTICKET".equalsIgnoreCase(mboremote.getName()))) {
			setValue("opticketid", mboremote.getString("opticketid"), 2L);
			setValue("STATUS", mboremote.getString("STATUS"), 2L);
			setValue("changedate", mboremote.getDate("statusdate"), 2L);
			setValue("CHANGEBY", mboremote.getUserInfo().getPersonId(), 11L);
			setValue("siteid", mboremote.getString("siteid"), 2L);
			setValue("orgid", mboremote.getString("orgid"), 2L);
			return;
		}
	}

	public void modify() throws MXException, RemoteException {
		super.modify();
		setValue("changedate", MXServer.getMXServer().getDate(), 2L);
		setValue("CHANGEBY", getUserInfo().getPersonId(), 2L);
	}

	public Vector getFuelVerifyStatusRecord() throws MXException,
			RemoteException {
		Vector v = new Vector();
		v.addElement(getMboValueData("changedate").getData());
		v.addElement(getMboValueData("memo").getData());
		v.addElement(getMboValueData("status").getData());
		v.addElement(getMboValueData("changeby").getData());
		v.addElement(getMboValueData("opticketid").getData());
		return v;
	}
	
	
}
